package com.design_pattern._03_behavioral._05_strategy;

import java.util.Comparator;

class AgeComparator implements Comparator<Person> {
    @Override
    public int compare(Person o1, Person o2) {
        return o1.age - o2.age;
    }
}

class WeightComparator implements Comparator<Person> {
    @Override
    public int compare(Person o1, Person o2) {
        return o1.weight - o2.weight;
    }
}

class HeighComparator implements Comparator<Person> {
    @Override
    public int compare(Person o1, Person o2) {
        return o1.heigh - o2.heigh;
    }
}

public class Person {
    public int heigh;
    public int weight;
    public int age;

    private Person() {
    }

    @Override
    public String toString() {
        return "age="+age+"\theigh="+heigh+"\tweight="+weight;
    }

    public static Builder getBuilder() {
        return new Builder();
    }

    static class Builder {
        Person person = new Person();

        public Builder weight(int weight) {
            person.weight = weight;
            return this;
        }

        public Builder age(int age) {
            person.age = age;
            return this;
        }

        public Builder heigh(int heigh) {
            person.heigh = heigh;
            return this;
        }

        public Person build() {
            return person;
        }
    }
}
